from pydantic_settings import BaseSettings
from pydantic import Field
from dotenv import load_dotenv
import logging

from . import ROOT_DIR


class EnvModule(BaseSettings):
    API_KEY: str = Field(description="用于访问llm的api key")
    BASE_URL: str = Field(description="llm的地址")
    MODEL_NAME: str = Field(description="llm的默认名称")
    OSS_ACCESS_KEY_ID: str = Field("阿里oss的access key id")
    OSS_ACCESS_KEY_SECRET: str = Field("阿里oss的access key secret")
    ENDPOINT: str = Field(description="阿里oss的endpoint")
    BUCKETNAME: str = Field(description="阿里oss的bucket name")
    REGION: str = Field(description="阿里oss的region")

    class Config:
        env_file = (ROOT_DIR / ".env").as_posix()
        load_dotenv(env_file)


ENV = EnvModule()

logging.info("环境变量初始化完成...")
